package com.znsd.zl.dict.aspect;

import com.znsd.zl.dict.utils.RedisTemplateUtils;
import com.znsd.zl.dict.utils.SaveCacheKey;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName DictItemAspect
 * @Description TODO
 * @Author zhubin
 * @Date 2020/8/19 15:32
 * @Version v1.0
 */
@Aspect
@Component
public class DictItemAspect {

	@Autowired
	RedisTemplateUtils redisTemplateUtils;

	@Pointcut("execution(public * com.znsd.zl.dict.controller.DictItemController.save(..))")
	public void save() {
	}

	@Pointcut("execution(public * com.znsd.zl.dict.controller.DictItemController.update(..))")
	public void update() {
	}

	@Pointcut("execution(public * com.znsd.zl.dict.controller.DictItemController.delete*(..))")
	public void delete() {
	}

	@Pointcut("save() || update() || delete()")
	public void all(){

	}

	@After("all()")
	public void after(){
		redisTemplateUtils.del(SaveCacheKey.getSaveCache());
	}
}
